package com.yylending.las;

import android.content.Context;
import android.text.TextUtils;
import com.yyfax.common.CLog;
import com.yyfax.common.tools.SystemTool;

/**
 * include global variable
 * APP运行时需要使用到，且随着编译模式而改变、或者不同设备运行时需要设置值的全局变量
 */
public class Global {
	private final static String TAG = "Global";

	public final static String SOURCE = "android";
	public static String API_VERSION = "2.0";
	public static String BASE_URL;

	public final static String VERSION_URL = BASE_URL + "sys/version/current";
	public final static String VERSION_PARAMS = "{'source':'android', 'version':'%1$d'}";

	public static String MAC_ID;
	public static String VERSION;

	public static String KEY_RSA = "";
	public static byte[] KEY_RSA_BYTES;

	/**
	 * 用之前要base64 decode
	 */
	public static String KEY_AES = "";
	public static byte[] KEY_AES_BYTES;
	public static String LOGIN_TOKEN = "";
	public static String LOGIN_REAL_NAME = ""; // 实名认证接口返回的用户名
	public static String LOGIN_ACCOUNT_NAME = ""; // 登录填的手机号.
	public static String LOGIN_USER_ID = "";
	public static String USER_NAME = ""; // 登录时返回的用户名, 已脱敏.
	public static String REGISTRATION_ID = ""; //极光REGISTRATION_ID
	/**
	 * 是否手势密码或者指纹锁定
	 */
	public static boolean LOCKED = false;
	/**
	 * 是否有新推送
	 */
	public static boolean NEW_PUSH = false;

	/***
	 * 帮助中心H5链接
	 */
	public static String HELP_URL = "h5/help.html";
	/***
	 * 关于我们H5链接
	 */
	public static String ABOUT_US_URL = "h5/introduce.html";
	/***
	 * 借款法律文件H5链接
	 */
	public static String LEGAL_DOCUMENT_URL = "h5/protocol.html";
	/***
	 * 借据中查看借款合同H5链接
	 */
	public static String DEBT_DOCUMENT_URL = "h5/protocol.html?type=loan";
	/***
	 * 登录注册协议H5链接
	 */
	public static String LOGIN_REGISTER_PROTOCOL_URL = "h5/pro.html";
	/**
	 * 支持银行卡列表链接
	 */
	public static final String SUPPORT_BANK_LIST_URL = "h5/bankList.html";

	/**
	 * 手势密码可尝试次数
	 */
	public final static int GESTURE_MAX_COUNT = 4;

	/**
	 * 最后一次定位的经度
	 */
	public static double mLongitude = 0.0;
	/**
	 * 最后一次定位的纬度
	 */
	public static double mLatitude = 0.0;

	/**
	 * 最大线上额度
	 */
	public static int mMaxOnlineQuota = 200000;
	/**
	 * 最小线上额度
	 */
	public static int mMinOnlineQuota = 30000;

	private static boolean mThirdPartyPageOpened = false; //是否打开了本app之外的界面

	public static boolean sHasNewMsg = false;

	public static boolean BACKGROUND = false;

	/**
	 * 是否需要刷新首页
	 */
	public static boolean NEED_REFRESH = true;

	public static void getBaseInfo(Context ctx) {
		if (TextUtils.isEmpty(MAC_ID))
			MAC_ID = SystemTool.getMacAddress();
		if (TextUtils.isEmpty(VERSION))
			VERSION = SystemTool.getAppVersionCode(ctx) + "";
		CLog.i(TAG, "initialization: MAC_ID=" + Global.MAC_ID);
	}

	/**
	 * 设置第三方组件界面打开标记
	 */
	public static void setThirdPartyPageOpenedFlag(boolean flag) {
		mThirdPartyPageOpened = flag;
	}

	/**
	 * 是否打开了第三方组件界面
	 */
	public static boolean isThirdPartyPageOpened() {
		return mThirdPartyPageOpened;
	}
}
